home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacsBug / MacsBug 6.2.1 / dcmds / C Samples / VBL.c < prev    next >
Text File  |  1991-05-01  |  2KB  |  110 lines

  1. /*     vbl.c
  2.     This is the VBL dcmd.
  3.  
  4.     Copyright © 1988 Apple Computer, Inc.  All rights reserved.
  5.  
  6.     Modification history:
  7.          2Dec88 sad        written from VCB.
  8.  
  9.     The following MPW commands will build the dcmd and copy it to the
  10.     "Debugger Prefs" file in the System folder. The dcmd's name in
  11.     MacsBug will be the name of the file built by the Linker.
  12.     You must first copy dcmd.h, dcmdGlue.a.o and DRunTime.o from the
  13.     C Samples folder into this folder.
  14.  
  15.     C Put.c
  16.     C VBL.c
  17.     Link dcmdGlue.a.o VBL.c.o put.c.o DRuntime.o "{Libraries}"Interface.o -o VBL
  18.     BuildDcmd VBL 1001
  19.     Echo 'include "VBL";'    |    Rez -a -o "{systemFolder}Debugger Prefs"
  20. */
  21.  
  22. #include <Types.h>
  23. #include <OSUtils.h>
  24. #include <Retrace.h>
  25.  
  26. #include "dcmd.h"
  27. #include "put.h"
  28.  
  29. #define VBLQueue ((QHdrPtr)0x160)
  30.  
  31.  
  32. static void DrawHdr()
  33. {
  34. //                             1         2         3         4         5         6         7
  35. //                    1234567890123456789012345678901234567890123456789012345678901234567890
  36.     dcmdDrawLine("\p    Addr Count Phase VBL at");
  37. }
  38.  
  39.  
  40. static void DrawVBL(VBLTask* vblp)
  41. {
  42.     PutUHexZTo((unsigned long)vblp->vblAddr,6,8);
  43.     PutSpace();
  44.     PutSpace();
  45.     PutUHexWord(vblp->vblCount);
  46.     PutSpace();
  47.     PutSpace();
  48.     PutUHexWord(vblp->vblPhase);
  49.     PutSpace();
  50.     PutUHexZTo((unsigned long)vblp,6,27);
  51.     PutLine();
  52. }
  53.  
  54.  
  55. pascal void CommandEntry(dcmdBlock* paramPtr)
  56. {
  57.     switch (paramPtr->request)
  58.         {
  59.         case dcmdInit:
  60.             break;
  61.  
  62.         case dcmdHelp:
  63.             dcmdDrawLine("\pvbl");
  64.             dcmdDrawLine("\p   Displays vertical retrace information.");
  65.             break;
  66.  
  67.         case dcmdDoIt:
  68.             {
  69.             VBLTask* vblp;
  70.             int numvbls = 0;
  71.  
  72.             dcmdSwapWorlds();
  73.  
  74.             dcmdDrawLine("\pDisplaying VBL tasks");
  75.  
  76.             if (VBLQueue->qFlags & 0x4000)
  77.                 dcmdDrawLine("\pVBLs executing");
  78.             else dcmdDrawLine("\pVBLs inactive");
  79.  
  80.           // get low-memory values after dcmdSwapWorlds()
  81.             vblp = (VBLTask*)(VBLQueue->qHead);
  82.  
  83.             DrawHdr();
  84.             while (vblp)
  85.                 {
  86.                 DrawVBL(vblp);
  87.                 numvbls++;
  88.                 if (paramPtr->aborted) break;
  89.                 if (vblp->qLink == 0)
  90.                     if (vblp != (VBLTask*)(VBLQueue->qTail))
  91.                         dcmdDrawLine("\pVBL queue does not end at VBLQueue.qTail");
  92.                 vblp = (VBLTask*)vblp->qLink;
  93.                 }
  94.  
  95.             PutUDec(numvbls);
  96.             PutPStr("\p VBL tasks");
  97.             PutLine();
  98.  
  99.             dcmdSwapWorlds();
  100.             }
  101.             break;
  102.  
  103.         default:
  104.             PutPStr("\punknown request ");
  105.             PutUDec(paramPtr->request);
  106.             PutLine();
  107.             break;
  108.         }
  109. } // CommandEntry
  110.